<!--  -->
<template>
  <div class="wash_list_item" :class="{ recommend: recommend }">
    <div v-if="recommend" class="tips">重点推荐</div>
    <div class="info_1">
      <div class="flex_top">
        <div class="image">
          <van-image
            src="https://img01.yzcdn.cn/vant/cat.jpeg"
            width="100%"
            height="100%"
            fit="cover"
          />
        </div>
        <div class="text">
          <div class="name">曼芙丽一站式洗车服务中心</div>
          <div class="flex">
            <div class="mark">5.0 <span>分</span></div>
            <div class="num">9999+服务次数</div>
          </div>
        </div>
      </div>
      <div class="distance">3.07KM</div>
    </div>
    <div
      v-for="item in 2"
      :key="item"
      class="info_2 flex"
      @click.stop="goDetail"
    >
      <div class="serve_name">标准洗车（小轿车）</div>
      <div class="flex">
        <div class="price flex">￥29.99</div>
        <div class="vip_price">
          ￥ 19.99
          <img
            class="vip_icon"
            :src="require('@/assets/icon/wash/vip.png')"
            alt=""
          />
        </div>
        <div class="btn flex">
          <van-button
            type="danger"
            size="mini"
            round
            @click.stop="markeSureOrder"
            >购买</van-button
          >
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  //import引入的组件需要注入到对象中才能使用
  name: "washCarListItem",
  components: {},
  data() {
    //这里存放数据
    return {};
  },
  props: {
    recommend: {
      default: false, //是否推荐
      type: Boolean,
    },
    item: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    markeSureOrder() {
      this.$emit("markeSureOrder");
    },
    goDetail() {
      this.$router.push({
        path: "/serveDetail",
      });
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang="less" scoped>
.wash_list_item {
  width: 100%;
  margin-bottom: 30px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: space-between;
  padding: 0 27px;
  position: relative;
  border-radius: 20px;

  .tips {
    padding: 15px 27px;
    background: linear-gradient(to bottom, #00bdf9, #015fea);
    border-top-left-radius: 20px;
    border-bottom-right-radius: 20px;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 34px;
    color: #fff;
  }

  .info_1,
  .info_2 {
    display: flex;
    width: 100%;
  }
  .info_1 {
    justify-content: space-between;
    .image {
      width: 200px;
      height: 200px;
      margin-right: 50px;
      margin-bottom: 20px;
    }
    .name {
      font-size: 46px;
    }
    .mark {
      font-size: 50px;
      color: #c10500;
      margin-right: 30px;
      span {
        font-size: 38px;
      }
    }
    .num {
      font-size: 38px;
      color: #888888;
      display: flex;
      align-items: center;
    }
    .distance {
      font-size: 38px;
      color: #888888;
      display: flex;
      align-items: center;
    }
  }
  .info_2 {
    align-items: center;
    justify-content: space-between;
    margin-bottom: 35px;
    .serve_name {
      font-size: 40px;
    }
    .price {
      font-size: 40px;
      color: #c10500;
      margin-right: 20px;
    }
    .vip_price {
      min-width: 295px;
      padding: 3px 20px;
      background-color: #3f4f7c;
      border: 3px solid #6b6a7b;
      box-sizing: border-box;
      text-align: right;
      color: #fff;
      border-radius: 999px;
      font-size: 28px;
      position: relative;
      .vip_icon {
        width: 177px;
        object-fit: contain;
        position: absolute;
        left: -3px;
        top: -10px;
      }
    }
    .btn {
      margin-left: 20px;
      /deep/ .van-button--mini {
        height: 60px;
        padding: 0 25px;
        border-radius: 999px;
        font-size: 30px;
      }
    }
  }
  .flex {
    display: flex;
    align-items: center;
  }

  .flex_top {
    display: flex;
    align-items: flex-start;
  }
}

.recommend {
  border: 3px solid #00b9f9;
  padding: 100px 27px 0 27px;
}
</style>
